package com.lu.banklog.controller;


import com.lu.banklog.pojo.dto.LogDTO;
import com.lu.banklog.pojo.entity.Trade;
import com.lu.banklog.service.TradeService;
import com.lu.banklog.utils.ResultUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Trade)表控制层
 *
 * @author makejava
 * @since 2024-10-22 17:09:46
 */
@RestController
@RequestMapping("log")
public class TradeController {

    @Resource
    private TradeService tradeService;

    @PostMapping("/add")
    public ResultUtil addLog(@RequestBody LogDTO dto){
        Trade trade = new Trade();
        BeanUtils.copyProperties(dto,trade);
        boolean save = tradeService.save(trade);
        if (save){
            return ResultUtil.success("操作成功");
        }
        return ResultUtil.fail("操作失败");
    }

}

